577A - Multiplication Table - CodeForces Solution


implementation number theory *1000

Please click on ads to support us..

Python Code:

l=list(map(int,input().split()))
n=l[0]
k=l[1]
count=0
for i in range(1,n+1):
    if (i<=k and k%i==0 and k/i<=n):
        count+=1
print(count)

C++ Code:

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i, n) for (ll i = 0; i < n; i++)
#define forn(i, n) for (ll i = 1; i < n; i++)
#define forne(i, n) for (ll i = 1; i <= n; i++)
#define revn(i, n) for (ll i = n - 1; i >= 0; i--)
#define sortl(v) sort(v.begin(), v.end())
#define reversal(v) reverse(v.begin(), v.end())
#define countset(n) __builtin_popcountll(n)
#define maxelement(v) *max_element(v.begin(), v.end())
#define minelement(v) *min_element(v.begin(), v.end())
#define vi vector<ll>
#define f(map) for (auto it : map)
#define read(n) \
    ll n;       \
    cin >> n;
const int inf = 1e9 + 7;
const int maxn = 1e6;
const int M = 1e9 + 7;
vector<ll> fact(1e6);
vector<ll> inversion(1e6);
vector<bool> seive(maxn, true);
void sieveness()
{
    seive[0] = seive[1] = false;

    for (ll i = 2; i * i <= maxn; i++)
    {
        if (seive[i] == true)
            for (ll j = i * i; j <= maxn; j += i)
            {
                seive[j] = false;
            }
    }
}
bool isprime(long long n)
{
    // check whether a number is prime or not
    for (long long i = 2; i * i <= n; i++)
        if (n % i == 0)
            return false;
    return true;
}
long long binpow(long long a, long long b, long long m)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
void initialization()
{
    fact[0] = 1;
    fact[1] = 1;
    for (ll i = 2; i <= 3000000; i++)
    {
        fact[i] = (fact[i - 1] * i) % M;
    }
    inversion[3000000] = binpow(fact[3000000], M - 2, M) % M;
    for (ll i = 3000000; i > 0; i--)
    {
        inversion[i - 1] = (inversion[i] * i) % M;
    }
}
ll C(ll n, ll k)
{
    ll res = (((fact[n] * inversion[k]) % M) * inversion[n - k]) % M;
    return res;
}
vector<ll> factorization(ll n)
{
    vector<ll> res;
    for (ll i = 1; i * i <= n; i++)
    {
        if ((n % i) == 0)
        {
            ll a = n / i;
            if (i == a)
            {
                res.push_back(i);
            }
            else
            {
                res.push_back(i);
                res.push_back(n / i);
            }
        }
    }
    return res;
}
ll andOperator(ll l, ll r)
{
    ll rtn = 0;
    for (ll i = 0; i <= 63; i++)
    {
        if (!(l & (1ll << i)))
            continue;
        if (!(r & (1ll << i)))
            continue;
        if ((l >> i) != (r >> i))
            continue;
        rtn += (1ll << i);
    }
    return rtn;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL), cout.tie(NULL);
    ll test = 1;
    // cin >> test;
    while (test--)
    {
        ll i, j, a, b, c, d, v1, v2, f, cnt, ans, res, print;
        read(n);
        read(x);
        cnt = 0;
        forne(i, n)
        {
            ll x1 = x / i;
            if (x1 <= n && x % i == 0)
                cnt++;
        }
        cout << cnt << endl;
    }

    return 0;
}


Comments

Submit
0 Comments
More Questions

190D - Non-Secret Cypher
1721B - Deadly Laser
1721C - Min-Max Array Transformation
1721A - Image
1180C - Valeriy and Deque
557A - Ilya and Diplomas
1037D - Valid BFS
1144F - Graph Without Long Directed Paths
1228A - Distinct Digits
355B - Vasya and Public Transport
1230A - Dawid and Bags of Candies
1530A - Binary Decimal
1472D - Even-Odd Game
441C - Valera and Tubes
1328E - Tree Queries
265A - Colorful Stones (Simplified Edition)
296A - Yaroslav and Permutations
967B - Watering System
152A - Marks
1398A - Bad Triangle
137A - Postcards and photos
1674D - A-B-C Sort
334A - Candy Bags
855A - Tom Riddle's Diary
1417A - Copy-paste
1038A - Equality
1061A - Coins
1676E - Eating Queries
1447A - Add Candies
1721D - Maximum AND